import http from '@/utils/request'
import * as Types from './interface'

// 登录
export const postLogin = (data: any) => {
  return http.post<Types.ResLogin>('/auth/login', data)
}

// 获取默认配置信息
export const getSkuAddress = () => {
  return http.get<Types.ResSettings>('/sku/address?phone=1')
}

// 修改地址
export const putAddress = (data: any) => {
  return http.put<Types.Result>('/address', data)
}

// 获取sku列表
export const getSku = () => {
  return http.get<Types.ResSku[]>('/sku')
}

// 新增sku信息
export const postSku = (data: any) => {
  return http.post<Types.Result>('/sku', data)
}

// 修改sku信息
export const putSku = (data: any) => {
  return http.post<Types.Result>('/sku', data)
}

// 删除sku信息
export const deleteSku = (id: number) => {
  return http.delete(`/sku/${id}`)
}

// 获取员工信息列表
export const getUsers = (data: any) => {
  return http.get<{ data: Types.ResUser[]; total: number }>('/users', data)
}

// 创建员工信息
export const postUsers = (data: any) => {
  return http.post('/users', data)
}

// 修改用户
export const putUsers = (data: any) => {
  return http.put(`/users/${data.id}`, data)
}

// 删除用户
export const deleteUsers = (id: number) => {
  return http.delete(`/users/${id}`)
}

// 获取订单列表
export const getOrders = (data: any) => {
  return http.get('/orders', data)
}

// 获取客户列表
export const getCustomers = (data: any) => {
  return http.get('/customers', data)
}
